import time

from appium.webdriver.common.appiumby import By

from utils.driver_utils import DriverUtils


class EnterHomePage:
    # 进入首页
    def enter_homepage(self,driver):
        time.sleep(5)
        # 手指滑动界面,共滑动三次
        # 注意：滑动的坐标，需要根据手机的分辨率进行适配
        for i in range(3):
            driver.swipe(start_x=1000, start_y=1000, end_x=80, end_y=1000, duration=500)
        # time.sleep(1)
        driver.find_element(by=By.ID, value="com.tpshop.malls:id/start_img").click()
        time.sleep(5)

if __name__ == '__main__':
    driver_utils = DriverUtils()
    enter_homepage = EnterHomePage()
    driver = driver_utils.get_driver()
    enter_homepage.enter_homepage(driver)
    driver_utils.quit_driver()

